package com.iximo.openAPI;

import java.io.InputStream;
import java.util.List;

import com.iximo.domain.Book;
import com.iximo.domain.Books;
import com.iximo.domain.Category;
import com.iximo.domain.Chapter;
import com.iximo.domain.Comments;


public interface IximoOpenAPIGet {
	/**
	 * 下载
	 * @param bookId 
	 */
	public String downloadBook(int bookId) throws Exception;
	/**
	 * 获取书的详细信息
	 * @param bookId
	 */
	public Book getBookInfo(int bookId) throws Exception;
	public Book getBookInfoData(InputStream inStream) throws Exception;
	/**
	 * 获取用户喜欢的书籍列表
	 * @param bookId
	 * @param num
	 */
	public List<Book> getBookByNum(int bookId, int num) throws Exception;
	public List<Book> getBookByNumData(InputStream inStream) throws Exception;
	/**
	 * 根据排行获取某类书的列表
	 * @param categoryId
	 * @param sort 
	 * 			order by hit,download,vote,favorite,comment
	 * @param page
	 * @param pageSize
	 */
	public List<Book> getBooksByCategary(int categoryId, String sort, int page, int pageSize) throws Exception;
	public List<Book> getBooksByCategaryData(InputStream inStream) throws Exception;
	/**
	 * 获取所有类型的书列表
	 * @param categoryId
	 */
	public List<Category> getAllCategory(int categoryId) throws Exception;
	public List<Category> getAllCategoryData(InputStream inStream) throws Exception;
	/**
	 * 获取各类排行的书列表
	 * @param type
	 * @param page
	 * @param pageSize
	 */
	public List<Book> getBookListByType(String type, int page, int pageSize) throws Exception;
	public List<Book> getBookListByTypeData(InputStream inStream) throws Exception;
	/**
	 * 获取某书的章节列表
	 * @param bookId
	 */
	public List<Chapter> getChapter(int bookId) throws Exception; 
	public List<Chapter> getChapterData(InputStream inStream) throws Exception; 
	/**
	 * 获取章节的内容
	 * @param chapterId
	 */
	public String getChapterContent(int chapterId) throws Exception;
	public String getChapterContentData(InputStream inStream) throws Exception;
	/**
	 * 获取某书的评论列表
	 * @param bookId
	 */
	public Comments getComment(int bookId, int page, int pagesize) throws Exception;
	public Comments getCommentData(InputStream inStream) throws Exception;
	/**
	 * 以关键字查找书
	 * @param keyWords
	 */
	public Books searchBook(String keyWords) throws Exception;
	public List<Book> searchBookData(InputStream inStream) throws Exception;
	/**
	 *  获取登录用户的书签
	 * @param page
	 * @param pageSize
	 */
	public List<Book> getBookMark(int page, int pageSize) throws Exception;
	public List<Book> getBookMarkData(InputStream inStream) throws Exception;
	/**
	 * 登录用户添加书签
	 * @param bookId
	 * @param categoryId
	 * @return 0: successful
			   1: this book is already added to favorite list
			   2: no login
			   3:book id or chapter id is wrong
	 */
	public int addBookMark(int bookId, int categoryId) throws Exception;
	/**
	 * 获取登录用户所喜欢的书列表
	 * @param page
	 * @param pageSize
	 */
	public List<Book> getFavoriteBook(int page, int pageSize) throws Exception;
	public List<Book> getFavoriteBookData(InputStream inStream) throws Exception;
	/**
	 * 添加某书到喜欢列表中
	 * @param bookId
	 * @return
	 *      0: successful
			1: this book is already added to favorite list
			2: no login
	 */
	public int addFavoriteBook(int bookId) throws Exception;
	/**
	 * 从喜欢列表删除某书
	 * @param favoriteId
	 * @return
	 */
	public int deleteFavorite(int favoriteId) throws Exception;
	/**
	 * 添加投票
	 * @param bookId
	 * @return
	 */
	public int addVote(int bookId) throws Exception;
	/**
	 * 获取登录用户之前下载的书列表
	 * @return
	 */
	public List<Books> getDownloadList() throws Exception;
	public List<Books> getDownloadListData(InputStream inStream) throws Exception;
	/**
	 * 获取热门书籍列表
	 * @param type : iphone,android,ipad
	 * @param recomment
	 * @param newbook
	 */
	public Books getHotBoooks(String type, int recomment, int newbook) throws Exception;	
	public Books getHotBoooksData(InputStream inStream) throws Exception;	
	/**
	 * 为某书评分
	 * @param score
	 * @param bookId
	 */
	public int randBook(int score, int bookId) throws Exception;
	/**
	 * 获取用户余额
	 * @param key
	 */
	public String getMemberBalance(String key) throws Exception;
	/**
	 * 获取购买章节列表
	 * @param bookId
	 * @param key
	 */
	public List<Chapter> getBuyChapterList(int bookId, String key) throws Exception;
	public List<Chapter> getBuyChapterListData(InputStream inStream) throws Exception;
	/**
	 * 购买某些章节
	 * @param bookId
	 * @param chapterId
	 * @param key
	 */
	public List<Chapter> payChapterList(int bookId, String key, String...chapterIds) throws Exception;
	public List<Chapter> payChapterListData(InputStream inStream) throws Exception;
	/**
	 * 获取通知
	 * @return
	 */
	public String getNotic() throws Exception;
	/**
	 * get Current Iphone Version
	 * @return
	 */
	public String getCurrentIphoneVersion() throws Exception;
	
}
